//
//  ZSBarButtonItem.m
//  微博-0C
//
//  Created by 周李波 on 16/7/20.
//  Copyright © 2016年 q. All rights reserved.
//

#import "ZSBarButtonItem.h"

@implementation ZSBarButtonItem

+ (instancetype)itemWithImageName:(NSString *)imageName title:(NSString *)title target:(nullable id)target action:(nonnull SEL)action{
    UIButton *button = [[UIButton alloc]init];
    ZSBarButtonItem *item = [[ZSBarButtonItem alloc]init];
    if (imageName) {
        [button setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    }
    if (title) {
        [button setTitle:title forState:UIControlStateNormal];
        [button setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
        button.titleLabel.font = [UIFont systemFontOfSize:15];
        
    }
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    [button sizeToFit];
    item.customView = button;
    return item;
}

@end
